#include <iostream>

//全局只构建一次
class Singleton
{
private:
    Singleton()
    {
        std::cout<<"构造函数"<<std::endl;
    }
public:
    static Singleton* Instance()
    {
        static Singleton s;
        return &s;
    }

    ~Singleton()
    {
        std::cout<<"析构函数"<<std::endl;
    }
};



int main()
{
    Singleton *s1 = Singleton::Instance();
    Singleton *s2 = Singleton::Instance();
    Singleton *s3 = Singleton::Instance();

    std::cout<<s1<<"\n"<<s2<<"\n"<<s3<<std::endl;
    return 0;
}